var haveRecProjectStore = null;
var haveRecPremisesStore = null;
var haveRecBuildingStore = null;
var haveRecUnitStore = null;
var haveRecRoomStore = null;
var gridStoreHave = null;

Ext.define('component.marketing.haveReceive', {
	extend : 'Ext.form.Panel',
	initComponent:function(){
		
		//项目
		haveRecProjectStore = new Ext.data.Store({
	        singleton:true,
	        autoDestroy:true,
	        fields: ["id", "projectName"],
	        proxy:{
	            type:'ajax',
	            url:contextPath+'/estate/project/findProjectList?needAuth=T&resourcesCode=menu_0003_0001',
	            reader:{
                   type: 'json', 
                   root: 'root'  //数据
              }
	        } ,
	        autoLoad: false
		});
		haveRecProjectStore.load({
			callback:function(records, options, success){
				var count = haveRecProjectStore.getCount();
				if(count>0){
					var id = haveRecProjectStore.getAt(0).get("id");
					Ext.getCmp('haveRecProjectStore').setValue(id)
				}
				if(Ext.Array.contains(idata,"fin:list:all")){
					var data = {"projectName": "全部", "id": '-1'};
					var rs = Ext.create(data);
					haveRecProjectStore.insert(count+1, rs);
				}
			}
		});
		//组团
		haveRecPremisesStore = new Ext.data.Store({
	        singleton:true,
	        autoDestroy:true,
	        fields: ["id", "groupName"],
	        proxy:{
	   			type:'ajax',
	            url:contextPath+'/estate/projectPremises/findPremisesList',
	            reader:{
                   type: 'json', 
                   root: 'root'  //数据
              	}
	        } ,
	        autoLoad: false
		});
		
		haveRecPremisesStore.on("beforeload", function(){
			haveRecPremisesStore.removeAll();
			haveRecBuildingStore.removeAll();
			haveRecUnitStore.removeAll();
			haveRecRoomStore.removeAll();
			Ext.getCmp("haveRecPremisesStore").setValue("");
			Ext.getCmp("haveRecBuildingStore").setValue("")
			Ext.getCmp("haveRecUnitStore").setValue("")
			Ext.getCmp("haveRecRoomStore").setValue("")
			var projectId = Ext.getCmp("haveRecProjectStore").getValue();
			if("-1" == projectId){
				projectId = "";
			}
			haveRecPremisesStore.proxy.extraParams.projectId = projectId;
		});
		//楼栋
		haveRecBuildingStore = new Ext.data.Store({
	        singleton:true,
	        autoDestroy:true,
	        fields: ["id", "buildingName"],
	        proxy:{
	   			type:'ajax',
	            url:contextPath+'/estate/projectBuilding/findBuildingList',
	            reader:{
                   type: 'json', 
                   root: 'root'  //数据
              	}
	        } ,
	        autoLoad: false
		});
		haveRecBuildingStore.on("beforeload", function(){
			haveRecBuildingStore.removeAll();
			haveRecUnitStore.removeAll();
			haveRecRoomStore.removeAll();
			Ext.getCmp("haveRecBuildingStore").setValue("")
			Ext.getCmp("haveRecUnitStore").setValue("")
			Ext.getCmp("haveRecRoomStore").setValue("")
			var projectId = Ext.getCmp("haveRecProjectStore").getValue();
			if("-1" == projectId){
				projectId = "";
			}
			var premisesId = Ext.getCmp("haveRecPremisesStore").getValue();
			haveRecBuildingStore.proxy.extraParams.projectId = projectId;
			haveRecBuildingStore.proxy.extraParams.premisesId = premisesId;
		});
		//单元
		haveRecUnitStore = new Ext.data.Store({
	        singleton:true,
	        autoDestroy:true,
	        fields: ["id", "unitName"],
	        proxy:{
	   			type:'ajax',
	            url:contextPath+'/estate/projectUnit/findUnitList',
	            reader:{
                   type: 'json', 
                   root: 'root'  //数据
              	}
	        } ,
	        autoLoad: false
		});
		haveRecUnitStore.on("beforeload", function(){
			haveRecUnitStore.removeAll();
			haveRecRoomStore.removeAll();
			Ext.getCmp("haveRecUnitStore").setValue("")
			Ext.getCmp("haveRecRoomStore").setValue("")
			var projectId = Ext.getCmp("haveRecProjectStore").getValue();
			if("-1" == projectId){
				projectId = "";
			}
			var premisesId = Ext.getCmp("haveRecPremisesStore").getValue();
			var buildingId = Ext.getCmp("haveRecBuildingStore").getValue();
			haveRecUnitStore.proxy.extraParams.projectId = projectId;
			haveRecUnitStore.proxy.extraParams.premisesId = premisesId;
			haveRecUnitStore.proxy.extraParams.buildingId = buildingId;
		});
		//房间
		haveRecRoomStore = new Ext.data.Store({
	        singleton:true,
	        autoDestroy:true,
	        fields: ["id", "roomName"],
	        proxy:{
	   			type:'ajax',
	            url:contextPath+'/estate/projectRoom/findRoomList',
	            reader:{
                   type: 'json', 
                   root: 'root'  //数据
              	}
	        } ,
	        autoLoad: false
		});
		haveRecRoomStore.on("beforeload", function(){
			haveRecRoomStore.removeAll();
			Ext.getCmp("haveRecRoomStore").setValue("")
			var projectId = Ext.getCmp("haveRecProjectStore").getValue();
			if("-1" == projectId){
				projectId = "";
			}
			var premisesId = Ext.getCmp("haveRecPremisesStore").getValue();
			var buildingId = Ext.getCmp("haveRecBuildingStore").getValue();
			var unitId = Ext.getCmp("haveRecUnitStore").getValue();
			haveRecRoomStore.proxy.extraParams.projectId = projectId;
			haveRecRoomStore.proxy.extraParams.premisesId = premisesId;
			haveRecRoomStore.proxy.extraParams.buildingId = buildingId;
			haveRecRoomStore.proxy.extraParams.unitId = unitId;
		});
		
		//房款类型
	    var typeHave = [
	         {"value":"","text":"请选择"},
	         {"value":"1","text":"认筹金"},
	         {"value":"3","text":"认购金"},
	         {"value":"5","text":"一次性全款"},
	         {"value":"6","text":"商业贷款-首付款"},
	         {"value":"7","text":"商业贷款-按揭款"},
	         {"value":"10","text":"公积金-首付款"},
	         {"value":"11","text":"公积金-按揭款"},
	         {"value":"12","text":"分期-一期款"},
	         {"value":"13","text":"分期-二期款"},
	         {"value":"14","text":"分期-三期款"},
	         {"value":"15","text":"分期-四期款"},
	         {"value":"16","text":"分期-五期款"},
	         {"value":"17","text":"组合贷款-首付款"},
	         {"value":"18","text":"组合贷款-银行按揭"},
	         {"value":"19","text":"组合贷款-公积金按揭"},
	         {"value":"20","text":"签约金"},
	         {"value":"23","text":"补差款"},
	         {"value":"26","text":"一次性全款(首付分期)"},
	         {"value":"27","text":"商业贷款首付款(首付分期)"},
	         {"value":"28","text":"商业贷款按揭款(首付分期)"},
	         {"value":"29","text":"分期一期款(首付分期)"},
	         {"value":"30","text":"分期二期款(首付分期)"},
	         {"value":"31","text":"分期三期款(首付分期)"},
	         {"value":"32","text":"分期四期款(首付分期)"},
	         {"value":"33","text":"分期五期款(首付分期)"}
	    ];
	    if(payDepositOff){
	    	typeHave=typeHave.del(1);
	    }
	    var relationTypeHave = Ext.data.Store({
	    	autoDestroy: true,
	        fields :["value","text"],
	        data : typeHave
	    });
	    
	    //房号list
	    var roomList = new Ext.data.Store({
	        singleton:true,
	        autoDestroy:true,
	        fields: ["combinedName", "id"],
	        proxy:{
	            type:'ajax',
	            url:jypath+'/marketing/haveReceiveRefund/findRoomId',
	            reader:{
                    type: 'json', 
                    root: 'root'  //数据
               }
	        },
	        autoLoad:true
        });
	    
	    //员工list
	    var haveRecUserList = new Ext.data.Store({
	        fields: ["userName", "id"],
	        proxy:{
	            type:'ajax',
	            url:jypath+'/customer/customer/userByProjectIdForGroup',
	            reader:{
                    type: 'json', 
                    root: 'root'  //数据
               }
	        },
	        autoLoad: false
        });
	    
	    haveRecUserList.on("beforeload", function(){
			var projectId = Ext.getCmp("haveRecProjectStore").getValue();
			if("-1" == projectId){
				projectId = "";
				return false;
			}
			haveRecUserList.proxy.extraParams.projectId = projectId;
		})
	    
		var formHave = Ext.create("Ext.form.Panel", {
			//minHeight:170,
		    title: "查询条件",
		    collapsible: true,  //可折叠
		    autoScroll: false,   //自动创建滚动条
		    defaultType: 'textfield',
		    defaults: {
		    	 anchor: '100%'
		    },
		    fieldDefaults: {
		        margin: 2,
		        labelWidth: 80,
                labelAlign: "right",
                margin: "0 0 10 0"
		    },
		    items: [{
			    xtype: "container",
			    layout: "hbox",
			    items: [
					{  
			            xtype:'combobox',
			            id:'haveRecProjectStore',
			            name: "projectId",
			            store: haveRecProjectStore,
			            valueField: "id",  
			            displayField: "projectName",
			            fieldLabel:'所属项目',
			            queryMode:'local',
			            typeAhead: true,
			            listeners:{
			            	'change':function(value){
			            		//加载组团数据
			            		if(value.lastValue && value.lastValue != "-1"){
			            			haveRecUserList.load();
			            			haveRecPremisesStore.load({
			            				callback: function(records, operation, success){
			            					//若无组团数据，加载楼栋
			            					var recordLen = records.length;
			            					if(recordLen == 0){
			            						haveRecBuildingStore.load();
			            					}
			            				}
			            			});
			            		}else{
			            			haveRecUserList.removeAll();
			            			haveRecPremisesStore.removeAll();
			            			haveRecBuildingStore.removeAll();
			            			haveRecUnitStore.removeAll();
			            			haveRecRoomStore.removeAll();
			            			Ext.getCmp("haveRecPremisesStore").setValue("");
			            			Ext.getCmp("haveRecBuildingStore").setValue("")
			            			Ext.getCmp("haveRecUnitStore").setValue("")
			            			Ext.getCmp("haveRecRoomStore").setValue("")
			            		}
			            	}
			            }
			        },
					{  
			            xtype:'combobox',
			            id:'haveRecPremisesStore',
			            name: "premisesId",
			            store: haveRecPremisesStore,
			            valueField: "id",  
			            displayField: "groupName",
			            queryMode:'local',
			            typeAhead: true,
			            listeners:{
			            	'change':function(value){
			            		//加载楼栋
			            		//若无楼栋数据，加载单元
			            		if(value.lastValue && value.lastValue != "-1"){
			            			haveRecBuildingStore.load({
			            				callback: function(records, operation, success){
			            					//若无组团数据，加载楼栋
			            					var recordLen = records.length;
			            					if(recordLen == 0){
			            						haveRecUnitStore.load();
			            					}
			            				}
			            			});
			            		}
			            	}
			            }
			        },
					{  
			            xtype:'combobox',
			            id:'haveRecBuildingStore',
			            name: "buildingId",
			            store: haveRecBuildingStore,
			            valueField: "id",  
			            displayField: "buildingName",
			            queryMode:'local',
			            typeAhead: true,
			            listeners:{
			            	'change':function(value){
			            		//加载单元
			            		//若无单元数据，加载房间
			            		if(value.lastValue && value.lastValue != "-1"){
			            			haveRecUnitStore.load({
			            				callback: function(records, operation, success){
			            					//若无组团数据，加载楼栋
			            					var recordLen = records.length;
			            					if(recordLen == 0){
			            						haveRecRoomStore.load();
			            					}
			            				}
			            			});
			            		}
			            	}
			            }
			        },
					{  
			            xtype:'combobox',
			            id:'haveRecUnitStore',
			            name: "unitId",
			            store: haveRecUnitStore,
			            valueField: "id",  
			            displayField: "unitName",
			            queryMode:'local',
			            typeAhead: true,
			            listeners:{
			            	'change':function(value){
			            		//加载房间
			            		if(value.lastValue && value.lastValue != "-1"){
			            			haveRecRoomStore.load();
			            		}
			            	}
			            }
			        },
					{  
			            xtype:'combobox',
			            id:'haveRecRoomStore',
			            name: "roomId",
			            store: haveRecRoomStore,
			            valueField: "id",  
			            displayField: "roomName",
			            queryMode:'local',
			            typeAhead: true
			        }
	        	]
			},{
		            xtype: "container",
		            layout: "hbox",
		            items: [
		                { xtype: "hiddenfield", name: "docType", value: "0"},
						{ 
							xtype: "checkboxgroup",
							id:"busStatusHave",
							fieldLabel: "业务类型",
							name :"receivablesType",
							width:400,
							items:[{
						    		boxLabel:'认筹',
						    		inputValue:'0'
						    		//hidden: payDepositOff
						    	},{
						    		boxLabel:'认购',
						    		inputValue:'1'
						    	},{
						    		boxLabel:'签约',
						    		inputValue:'2'
						    	},{
						    		boxLabel:'面积补差',
						    		inputValue:'3'
						    	}
						     ]
						}
		            ]
	            },{
		            xtype: "container",
		            layout: "hbox",
		            items: [
		                {  
		                  xtype:'combobox',
		 		    	  fieldLabel:'房款类型',
		 		    	  store:relationTypeHave,
		 		    	  displayField: "text",
		 		    	  valueField:"value",
		 		    	  id:'relationTypeHC',
		 		    	  name:'housingFundType'
	        	        },
						{ xtype:'combobox',
			 		    	  fieldLabel:'经&nbsp;&nbsp;纪&nbsp;人',
			 		    	  store:haveRecUserList,
			 		    	  displayField: "userName",
			 		    	  valueField:"id",
			 		    	  name:'createUserId'
			 		    }
		            ]
	            },{
		            xtype: "container",
		            layout: "hbox",
		            items: [
						{ xtype: "textfield", name: "relationCode", fieldLabel: "业务编号"},
						{ xtype: "textfield", name: "customer_name", fieldLabel: "客户名称"}
		            ]
	            },{
	            	 xtype: "container",
			         layout: "hbox",
			         items:[
						{
							xtype:'container',
							layout:'hbox',
							items:[{
								xtype:'datefield',
						        fieldLabel:'开始有效日期',
						        name:'ysDateStart',
						        format: 'Y-m-d'
							},{
								xtype:'datefield',
								name:'ysDateEnd',
						        format: 'Y-m-d',
						        fieldLabel:'结束有效日期'
							}]
						}
	                ]
	            }
	        ],
		    buttons: [
	  	        { xtype: "button", text: "查询", 
	  	        	handler:function(){
	  	        		//获取通过checkboxgroup定义的checkbox值
	  	        		//业务状态
	  	        		var busStatusValue = Ext.getCmp('busStatusHave').getChecked();
	  	        		var busStatus="";
	  	        		Ext.Array.each(busStatusValue, function(item){
	  	        			busStatus += item.inputValue+',' ;
	  	        		});
	  	        		gridStoreHave.getProxy().extraParams.receivablesType = busStatus;
	  	        		gridStoreHave.load();
	  	        		var pagingTool=Ext.getCmp("pagingTool2");
	  	        		pagingTool.moveFirst();//跳至第一页
	  	        	}  
	  	        },{
	  	        	 xtype: "button", hidden:finHaveReceiveExport,text: "导出",handler:function(){
	  	        		var count = gridHave.getStore().getCount();
	  	        		if(count<=0){
	  	        			Ext.MessageBox.alert("系统提示","没有可导出的数据");
	  	        		}else{
	  	        			var busStatusValue = Ext.getCmp('busStatusHave').getChecked();
		  	        		var busStatus="";
		  	        		Ext.Array.each(busStatusValue, function(item){
		  	        			busStatus += item.inputValue+',' ;
		  	        		});
		  	        		gridStoreHave.getProxy().extraParams.receivablesType = busStatus;
		  	        		var value = encodeURI(encodeURI(JSON.stringify(gridStoreHave.getProxy().extraParams),"utf-8"));
		  	        		var url = jypath + "/marketing/haveReceiveRefund/haveReceicerefundExport?json="+value;
		  	        		location.href = url;
	  	        		}
		  	        	}
		  	        },
	  	        { xtype: "button", text: "清空",handler:function(){
	  	        		formHave.getForm().reset();
	  	        	}
	  	        }
	  	    ]    
	});
	
	 gridStoreHave = Ext.create('Ext.data.Store', {
        fields: ["customer_name", "customerFamilyName", "combined_name", "calculatArea", "price", "totalPrice", "relationType",
                 "businessType", "billCode", "statement", "bankAccount", "reChecked"
                 , "receivablesDate","realAmount","remark"],
        pageSize: 10,  //页容量15条数据
        //是否在服务端排序 （true的话，在客户端就不能排序）
        remoteSort: false,
        proxy: {
            type: 'ajax',
            url: jypath+'/marketing/haveReceiveRefund/list?resourcesCode=menu_0003_0001',
            actionMethods: { read: 'POST' },
            reader: {   //这里的reader为数据存储组织的地方，下面的配置是为json格式的数据，例如：[{"total":50,"rows":[{"a":"3","b":"4"}]}]
                type: 'json', //返回数据类型为json格式
                root: 'rows',  //数据
                totalProperty: 'total' //数据总条数
            }
        },
        autoLoad: true  //即时加载数据
    });
	
	gridStoreHave.on("beforeload",function(){
        Ext.apply(gridStoreHave.proxy.extraParams,formHave.getForm().getValues());
        var projectId = Ext.getCmp("haveRecProjectStore").getValue();
        if(projectId == "-1"){
        	gridStoreHave.proxy.extraParams.projectId = "";
        }
        var newResCode = "menu_0003_0001";
        gridStoreHave.proxy.extraParams.resourcesCode = newResCode;
    });
	
	var gridHave = Ext.create('Ext.grid.Panel', {
		minHeight:450,
		minWidth:300,
        store: gridStoreHave,
        columnLines: true,
        columns: [{  
            text : "操作",  
            dataIndex: 'actioncolumn',
            width:250,
            locked   : true,
            renderer : function(value,cellmeta,record,rowIndex,columnIndex,store) {
            	var rec = gridHave.getStore().getAt(rowIndex);
                //冲销
            	if(finHaveReceivewWriteOff==false){
            		var html = '<a onclick="chongxiao('+rec.get('id')+')" style="cursor:pointer">冲销</a>';
            	}else{
            		var html = "";
            	}
	        	if(finHaveReceiveForTickets==false){
	        		//换票
		        	html += '&nbsp;<a onclick="tickets('+rec.get('id')+')" style="cursor:pointer">换票</a>';
	        	}else{
	        		html += "";
	        	}
	        
	        	if(finHaveReceiveRefund==false){
	        		//退款
		        	if(rec.get('reChecked') != "1"){
		        		html += '<a onclick="refund_have('+rec.get('id')+')" style="cursor:pointer">退款</a>&nbsp;';
		        	}
	        	}else{
	        		html+="";
	        	}
	        	if(!dataRepairHaveReceiveDate ){
	        		html+="&nbsp;<a href='javascript:correct("+rec.get('id')+")'>收款日期变更</a>";
	        	}

                html += "&nbsp;<a href='javascript:parent.openMenu(\"0\",\"print_"+rec.get('id')+"\",\"\",\"收据打印\",\"/marketing/haveReceiveRefund/toPrint?id="+rec.get('id')+"&returnUrl=,marketing,pin,index\")' style='cursor:pointer'>打印</a>";
	        	
	        	return html;
            }
        },{
            text     : '客户名称', 
            dataIndex: 'customer_name'
        },{
			text     : '共同购房者',
			dataIndex: 'customerFamilyName'
		},{
            text     : '房号',
            dataIndex: 'combined_name',
            width:135
        },{
            text     : '签约面积(㎡)',
            dataIndex: 'calculatArea'
        },{
            text     : '签约单价(元)',
            dataIndex: 'price', renderer: Ext.util.Format.numberRenderer('0,000.00')
        },{
            text     : '签约金额(元)',
            dataIndex: 'totalPrice', renderer: Ext.util.Format.numberRenderer('0,000.00')
        },{
            text     : '房款类型',
            dataIndex: 'relationType'
        },{
            text     : '业务标志',
            dataIndex: 'businessType'
        },{
            text     : '发生额',
            dataIndex: 'realAmount', renderer: Ext.util.Format.numberRenderer('0,000.00')
        },{
            text     : '票据号码',
            dataIndex: 'billCode'
        },{
            text     : '应收日期',
            dataIndex: 'receivablesDate',
            renderer : function(val) {
            	return dateFormat(val);
            }
        },{
            text     : '结算日期/结算人员/结算方式',
            dataIndex: 'statement',
            width:150
        },{
            text     : '结算银行',
            dataIndex: 'bankAccount'
        },{
            text     : '备注',
            dataIndex: 'remark',
            width:135, 
            renderer: function(val){
            	if(val!=null&&val!=""){
            		var nowLeng = val.length;
            		if ( nowLeng > 10 ) {
            			var nowWord = val.substr(0, 10) + '···';
            			return nowWord;
            		}
            	}
            	return val;
            }
        },{
            text     : '复核状态',
            dataIndex: 'reChecked',
            renderer : function(val) {
            	var html = "";
            	if(val == "0" || val == ""){
            		html = "未复核";
            	}else if(val == "1"){
            		html = "已复核";
            	}
            	return html;
            }
        }],
        title: '已收款明细列表',
        dockedItems: [{  
            xtype: 'pagingtoolbar',  
            store: gridStoreHave,   // GridPanel中使用的数据  
            dock: 'bottom',  
            displayInfo: true,  
            emptyMsg:"没有数据",  
            displayMsg:"显示从{0}条数据到{1}条数据，共{2}条数据",
            id:'pagingTool2'
        }
        ]
    });
		
		var defaultConfigHave = {
				defaults: {  
		            split: true,    //有分割线  
		            collapsible: true  //可以折叠
		        },
				items:[formHave,gridHave]
		};
		Ext.apply(this,defaultConfigHave);
		this.callParent(arguments);
		
	}

});

function chongxiao(id){
	Ext.MessageBox.confirm("提示","请确认是否冲销？",function(btn,txt){
    	if(btn=="yes"){
    		Ext.Ajax.request({
    			 url: jypath+'/marketing/haveReceiveRefund/edit',
                 params: { "id": id, "delFlag":"1"},
                 method: 'POST',
                 callback: function (options, success, response) {
                	 if (success) {
                		 Ext.MessageBox.alert("系统提示","冲销成功");
                		 location.href = jypath + "/marketing/needReceiveRefund/index";
                	 }else{
                		 Ext.MessageBox.alert("系统提示","冲销失败");
                	 }
                 }
    		});
        }
    });
}

function tickets(id){
	location.href = jypath + "/marketing/haveReceiveRefund/view?id="+id;
}

function refund_have(id){
	location.href = jypath + "/marketing/haveReceiveRefund/refund_view?id="+id;
}

function dateFormat(value){ 
    if(null != value){ 
        return Ext.Date.format(new Date(value),'Y-m-d'); 
    }else{ 
        return null; 
    } 
}
function correct(id){
	Ext.Ajax.request({
		url: jypath+'/hoxfit/findHaveReceiveRefundById',
        params: { "id": id},
        method: 'POST',
        callback: function (options, success, response) {
        	var obj = eval('(' + response.responseText + ')');
        	var statementDate = Ext.Date.format(new Date(obj.statementDate),'Y-m-d');
        	
        	var fromPanel =   Ext.create("Ext.form.Panel", {
    			collapsible : false, 
    			autoScroll : false, 
    			defaultType : 'textfield',
    			defaults : {
    				anchor : '100%'
    			},
    			fieldDefaults : {
    				flex : 1
    			},	
    			items : [{
    				xtype: "datefield",
    				fieldLabel: "结算日期",
    				format:'Y-m-d',
    				id:'statementDateValue',
    	            value:statementDate
      		     }]
        	});
        	
        	
        	
        	var window = Ext.create('Ext.Window', {
     		   title: "修正数据",
     	        width: 300,
     	        closable: true,
     	        modal : true,
     	        headerPosition: 'top',
     	        items: [fromPanel],
     	        buttons:[{
     	        	xtype: "button",
     	        	text: "确定",
     	        	iconCls:'icon-save',
     	        	handler: function(){
     	        		
     	        		

    	        		
    	        		var statementDateValue = Ext.Date.format(new Date(Ext.getCmp("statementDateValue").getValue()),'Y-m-d');
    	        		Ext.Ajax.request({
    	        			 url: jypath+'/hoxfit/updateHaveReceiveRefundDate',
    	                     params: { haveId:id,statementDate:statementDateValue},
    	                     method: 'POST',
    	                     callback: function (options1, success1, response1) {
    	                    	 if (success1) {
    	                    		 var obj = eval('(' + response1.responseText + ')');
    	                    		 if(obj.res=="1"){
    	                    			 Ext.MessageBox.alert("系统提示","修正已收款记录成功");
    	                    			 gridStoreHave.load();
    		                    		 window.close();
    	                    		 }else if(obj.res=="100"){
    	                    			 Ext.MessageBox.alert("系统提示","该账号没有修复权限");
    	                    		 }
    	                    		
    	                    	 }else{
    	                    		 Ext.MessageBox.alert("系统提示","修正已收款记录失败！");
    	                    	 }
    	                     }
    	        		});
    	        		
    	        	
     	        		
     	        	
     	        	}
     	        }]
     	       
     	});
     	window.show();
        	
        	
        }
	});
	
}

